<template>
  <div>
    <el-table :data="list" border fit highlight-current-row style="width: 100%">
      <el-table-column
        v-loading="loading"
        align="center"
        label="ID"
        width="65"
        element-loading-text="请给我点时间！"
        prop="id"
      />
      <template v-if="type === '1'">
        <el-table-column prop="label_num" align="center" label="标签编号" />
        <el-table-column prop="is_label" align="center" label="标签有无" />
        <el-table-column prop="label_crack" align="center" label="标签裂纹" />
        <el-table-column prop="label_dama" align="center" label="标签破损" />
        <el-table-column prop="label_info" align="center" label="标签信息" />
      </template>
      <template v-if="type === '2'">
        <el-table-column prop="ink_num" align="center" label="喷码编号" />
        <el-table-column prop="ink_is" align="center" label="喷码有无" />
        <el-table-column prop="ink_cd" align="center" label="喷码重叠" />
        <el-table-column prop="ink_wx" align="center" label="喷码歪斜" />
        <el-table-column prop="ink_jynq" align="center" label="喷码挤压扭曲" />
        <el-table-column prop="ink_zf" align="center" label="喷码字符" />
      </template>
      <template v-if="type === '3'">
        <el-table-column prop="box_num" align="center" label="纸箱编号" />
        <el-table-column prop="box_sljc" align="center" label="产品数量检测" />
        <el-table-column prop="box_sfcw" align="center" label="纸箱是否错误" />
      </template>
      <template v-if="type === '4'">
        <el-table-column prop="wg_num" align="center" label="纸箱编号" />
        <el-table-column prop="wg_xcjc" align="center" label="瑕疵检测" />
        <el-table-column prop="wg_xb" align="center" label="形变/破损" />
        <el-table-column prop="wg_ys" align="center" label="颜色检测" />
        <el-table-column prop="wg_dl" align="center" label="断裂/缺料" />
        <el-table-column prop="wg_hs" align="center" label="划伤检测" />
      </template>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  </div>
</template>

<script>
import { getBj } from '@/api/data'
import Pagination from '@/components/Pagination'

export default {
  components: { Pagination },
  props: {
    type: {
      type: String,
      default: '1'
    }
  },
  data() {
    return {
      list: null,
      listQuery: {
        status: this.type,
        page: 1,
        limit: 10
      },
      total: 200,
      loading: false
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      getBj(this.listQuery).then(res => {
        this.list = res.result.data
        this.total = res.result.total
        this.loading = false
      })
    }
  }
}
</script>

